(function (lib, config) {
    var loadFunc = function () {
        var textAry = config.words.split('|'), bgcolorAry = config.bgcolor.split('|'), textcolorAry = config.textcolor.split('|'), imglinkAry = config.imglink.split('|'), weblinkAry = config.weblink.split('|'), identiAry = config.identifier.split('|');
        textAry[0] = textAry[0] || '彩超检查';
        textAry[1] = textAry[1] || '11元';
        textAry[2] = textAry[2] || '早孕血HCG检测';
        textAry[3] = textAry[3] || '11元';
        textAry[4] = textAry[4] || '凤凰医院妇科带头人';
        textAry[5] = textAry[5] || '早孕诊断';
        textAry[6] = textAry[6] || '无痛人流';
        textAry[7] = textAry[7] || '上环取环：';
        textAry[8] = textAry[8] || '宫颈疾病';
        textAry[9] = textAry[9] || '妇科炎症';
        textAry[10] = textAry[10] || '女性不孕';
        textAry[11] = textAry[11] || '妹妹，月经推迟几天了？有没有嗜睡、恶心、呕吐...的反应？';
        textAry[12] = textAry[12] || '有没有做过相应的早孕检查？花几分钟和我聊聊比自己看更清楚些。';
        bgcolorAry[0] = bgcolorAry[0] || '#ffffff';
        bgcolorAry[1] = bgcolorAry[1] || '#fdd9d9';
        bgcolorAry[2] = bgcolorAry[2] || '#ffffff';
        bgcolorAry[3] = bgcolorAry[3] || '#ffffff';
        bgcolorAry[4] = bgcolorAry[4] || '#f3f3f3';
        bgcolorAry[5] = bgcolorAry[5] || '#eaeaea';
        bgcolorAry[6] = bgcolorAry[6] || '#ffffff';
        bgcolorAry[7] = bgcolorAry[7] || '#ffffff';
        textcolorAry[0] = textcolorAry[0] || '#333333';
        textcolorAry[1] = textcolorAry[1] || '#ff0000';
        textcolorAry[2] = textcolorAry[2] || '#ffffff';
        textcolorAry[3] = textcolorAry[3] || '#f06a6b';
        textcolorAry[4] = textcolorAry[4] || '#fe9f21';
        textcolorAry[5] = textcolorAry[5] || '#999999';
        textcolorAry[6] = textcolorAry[6] || '#ffffff';
        textcolorAry[7] = textcolorAry[7] || '#333333';
        imglinkAry[0] = imglinkAry[0] || 'http://s3g.85613333.com/swt/images/logo.jpg';
        imglinkAry[1] = imglinkAry[1] || 'http://s3g.85613333.com/swt/images/ea2e95d88bf4739d6ca3c4f910586742.png';
        imglinkAry[2] = imglinkAry[2] || 'http://s3g.85613333.com/swt/images/san.png';
        identiAry[0] = identiAry[0] || 'piaofu-tan';
        function getScrollTop() {
            var scrollTop = 0;
            if (document.documentElement && document.documentElement.scrollTop) {
                scrollTop = document.documentElement.scrollTop;
            }
            else if (document.body) {
                scrollTop = document.body.scrollTop;
            }
            return scrollTop;
        }
        function getClientHeight() { //获取可视高度
            var clientHeight = 0;
            if (document.body.clientHeight && document.documentElement.clientHeight) {
                var clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            else {
                var clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
            }
            return clientHeight;
        }
        var _ua = navigator.userAgent, _ua_text = false, _position = "fixed";
        if (_ua.indexOf('baiduboxapp') > -1) {
            _ua_text = true; _position = "absolute";
        }

        var strVar = [];
        strVar.push("<style>");
        strVar.push("ul,dl,dt,dd,p,ol{ margin:0; padding:0;} body{ position:relative;}");
        strVar.push("ul li,ol li,li{ list-style:none;}");
        strVar.push("a{ text-decoration:none; color:" + textcolorAry[0] + ";}");
        strVar.push("img{ max-width:100%; border:none;}");
        strVar.push(".msrlswtqp{  background: " + bgcolorAry[0] + ";  position: " + _position + "; max-width: 640px;  left: 0;  right: 0;  z-index: 99999999; margin: 0 auto; top:0; min-width:320px; height:100%; overflow-y:auto;} .rlswt_con{ position:relative;}");
        strVar.push("#msrlswtqp{ display:none;}");
        strVar.push("@media only screen and (min-width: 640px){");
        strVar.push(".msrlswtqp{font-size:24px;}");
        strVar.push("}");
        strVar.push("@media only screen and (min-width: 540px)and (max-width: 639px){");
        strVar.push(".wrap{font-size:18px;}");
        strVar.push("} @media only screen and (min-width: 414px)and (max-width: 539px){");
        strVar.push(".msrlswtqp{font-size:16px;}");
        strVar.push("} @media only screen and (min-width:375px)and (max-width:413px){");
        strVar.push(".msrlswtqp{font-size:15px;}");
        strVar.push("} @media only screen and (min-width:342px)and (max-width:374px){");
        strVar.push(".msrlswtqp{font-size:14px;}");
        strVar.push("} @media only screen and (min-width:320px)and (max-width:341px){");
        strVar.push(".msrlswtqp{font-size:12px;}");
        strVar.push("}");
        strVar.push(".rl_head{ position:relative;} .rl_head img{ display:block;}");
        strVar.push(".rl_head p{ text-align:center; width:65%; margin:0 auto; border-radius:.5em; background:rgba(255, 255, 255, 0.6);filter:Alpha(opacity=60); position:absolute; bottom:6%; padding:.8% 0; left:0; right:0; font-size:.9em;}");
        strVar.push(".rl_head p span{ color:" + textcolorAry[1] + ";}");
        strVar.push(".rl_head a{ position:absolute; top:42%; left:2%; color:" + textcolorAry[2] + "; font-size:1em;}");
        strVar.push(".rl_content{ background-color:" + bgcolorAry[1] + "; padding:6% 0;}");
        strVar.push(".rl_content dl{ overflow:hidden; text-align:center;}");
        strVar.push(".rl_content dt{  width:28%; margin:0 auto;}");
        strVar.push(".rl_content dd{ line-height:1.6em;}");
        strVar.push(".rl_content dd:nth-child(2){ color:" + textcolorAry[3] + "; font-weight:bold; font-size:1.5em; margin:1% 0;}");
        strVar.push(".rl_content ul{ overflow:hidden; width:80%; margin:4% auto 6%;}");
        strVar.push(".rl_content ul li{ float:left; width:33%; text-align:center; border-right:1px #666666 solid;}");
        strVar.push(".rl_content ul li:last-child{ border-right:none;}");
        strVar.push(".rl_content ul li span{ display:block; font-weight:bold;}");
        strVar.push(".rl_content ol{ overflow:hidden; width:84%; margin:0 auto;}");
        strVar.push(".rl_content ol li{ overflow:hidden; float:left; width:75%; text-align:center;}");
        strVar.push(".rl_content ol li:nth-child(1){ font-weight:bold; width:25%;}");
        strVar.push(".rl_content ol li a{ float:left; width:31%; background-color:" + bgcolorAry[2] + "; margin-left:2%; display:inline-block; margin-bottom:2%; padding:1% 0;}");
        strVar.push(".rl_dhk{ background-color:" + bgcolorAry[4] + "; padding:4% 4% 10%; position:relative; top:-1em;}");
        strVar.push(".dhjm{ text-align:center; background-color:" + bgcolorAry[5] + "; color:" + textcolorAry[4] + "; border:1px #cccccc solid; width:60%; margin:0 auto; padding:2% 0; border-radius:.5em; display:block;}");
        strVar.push(".rl_times{ text-align:center; margin:3% 0;}");
        strVar.push(".dhk_s{ margin-top:4%;}");
        strVar.push("#hycq_dhk01,#hycq_dhk02{display:none; }");
        strVar.push(".dhk_s ul{ overflow:hidden;}");
        strVar.push(".dhk_s ul li{ float:left}");
        strVar.push(".dhk_s ul a{ color:" + textcolorAry[7] + "}");
        strVar.push(".dhk_s ul li:first-child{ width:16%; margin-right:6%;}");
        strVar.push(".dhk_s ul li:last-child{ width:78%;}");
        strVar.push(".dhk_s ul li span{ display:inline-block; padding:4% 3%; background-color:" + bgcolorAry[6] + "; border-radius:.5em; position:relative; width:100%;   box-sizing: border-box; line-height:1.6em; border:1px #d4d4d4 solid; position:relative;}");
        strVar.push(".dhk_s ul li span i{ width:1.5em; display:inline-block; position:absolute; left:-1em; top:30%;}");
        strVar.push(".dhk_s ul li span i img{ width:70%;}");
        strVar.push(".rl_input{  border:1px #d4d4d4 solid; border-radius:.5em; background-color:" + bgcolorAry[7] + "; overflow:hidden; height:3em; padding:1% 0; box-sizing:border-box; position:fixed; bottom:0; max-width:640px; min-width:320px; left:0; right:0; margin:0 auto;}");
        strVar.push(".rl_input span{ float:left; display:block;  height:100%; box-sizing:border-box;}");
        strVar.push(".rl_input .rl_span1{ width:12%; text-align:center; padding-top:0.5em; }");
        strVar.push(".rl_input .rl_span2{ border-left:1px #d4d4d4 solid; width:67%; padding-left:4%;  color:" + textcolorAry[5] + ";  padding-top:0.5em;}");
        strVar.push(".rl_input .rl_span3{ background:url(http://s3g.85613333.com/swt/images/button.jpg) no-repeat; background-size:100% 100%; width:20%; text-align:center; color:" + textcolorAry[6] + ";  padding-top:0.5em;}");
        strVar.push(".rl_input .rl_span1 img{ width:26%;}");
        strVar.push("</style>");
        strVar.push("    <div class=\"msrlswtqp\" id=\"msrlswtqp\" style=\"top:0;\">");
        strVar.push("        <div class=\"rlswt_con\">");
        strVar.push("            <div class=\"rl_head\">");
        strVar.push("                <img src=\"" + imglinkAry[0] + "\">");
        strVar.push("                <p>" + textAry[0] + "<span>" + textAry[1] + "</span>&nbsp;&nbsp;" + textAry[2] + "<span>" + textAry[3] + "</span></p>");
        strVar.push("                <a onclick=\"swt_center_nswt()\">&lt;返回</a>");
        strVar.push("            </div>");
        strVar.push("            <div class=\"rl_content\">");
        strVar.push("                <dl>");
        strVar.push("                    <dt><img src=\"" + imglinkAry[1] + "\"></dt>");
        strVar.push("                    <dd></dd>");
        strVar.push("                    <dd>" + textAry[4] + "</dd>");
        strVar.push("                </dl>");
        strVar.push("                <ul>");
        strVar.push("                    <li><span>4571</span>预约量</li>");
        strVar.push("                    <li><span>6374</span>问诊量</li>");
        strVar.push("                    <li><span>9.9</span>患者好评</li>");
        strVar.push("                </ul>");
        strVar.push("                <ol>");
        strVar.push("                    <li>擅长领域：</li>");
        strVar.push("                    <li>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[5] + "</a>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[6] + "</a>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[7] + "</a>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[8] + "</a>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[9] + "</a>");
        strVar.push("                        <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">" + textAry[10] + "</a>");
        strVar.push("                    </li>");
        strVar.push("                </ol>");
        strVar.push("            </div>");
        strVar.push("            <div class=\"rl_dhk\">");
        strVar.push("                <a class=\"dhjm\" href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">对话全程加密，请放心交流</a>");
        strVar.push("                <div class=\"dhk_box\">");
        strVar.push("                    <div id=\"hycq_dhk01\" class=\"dhk_s\">");
        strVar.push("                        <p class=\"rl_times\" id=\"rl_times\"></p>");
        strVar.push("                        <ul>");
        strVar.push("                            <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">");
        strVar.push("                                <li><img src=\"" + imglinkAry[1] + "\"></li>");
        strVar.push("                                <li>");
        strVar.push("                                    <span id=\"rl_dhlist1\">");
        strVar.push("                                        <i><img src=\"" + imglinkAry[2] + "\"></i>");
        strVar.push("                                        <p>" + textAry[11] + "</p>");
        strVar.push("                                    </span>");
        strVar.push("                                </li>");
        strVar.push("                            </a>");
        strVar.push("                        </ul>");
        strVar.push("                    </div>");
        strVar.push("                    <div id=\"hycq_dhk02\" class=\"dhk_s\">");
        strVar.push("                        <ul>");
        strVar.push("                            <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">");
        strVar.push("                                <li><img src=\"" + imglinkAry[1] + "\"></li>");
        strVar.push("                                <li>");
        strVar.push("                                    <span id=\"rl_dhlist2\">");
        strVar.push("                                        <i><img src=\"" + imglinkAry[2] + "\"></i>");
        strVar.push("                                        <p>" + textAry[12] + "</p>");
        strVar.push("                                    </span>");
        strVar.push("                                </li>");
        strVar.push("                            </a>");
        strVar.push("                        </ul>");
        strVar.push("                    </div>");
        strVar.push("                </div>");
        strVar.push("            </div>");
        strVar.push("        </div>");
        strVar.push("        <div class=\"bottomdiv\" id=\"bottomdiv\"></div>");
        strVar.push("        <div class=\"rl_input\">");
        strVar.push("            <a href=\"javascript:void(0);\" onclick=\"openZoosUrl() \">");
        strVar.push("                <span class=\"rl_span1\">");
        strVar.push("                    <img src=\"http://s3g.85613333.com/swt/images/icon.jpg\">");
        strVar.push("                </span>");
        strVar.push("                <span class=\"rl_span2\" id=\"rl_span2\">请在此输入你的问题</span>");
        strVar.push("                <span class=\"rl_span3\">发送</span>");
        strVar.push("            </a>");
        strVar.push("        </div>");
        strVar.push("    </div>");

        var o = document.createElement('section');
        o.innerHTML = strVar.join('');
        while (o.firstElementChild) {
            document.body.appendChild(o.firstElementChild);
        };
        hycq_dhk01 = function () {
            document.getElementById("hycq_dhk01").style.display = "block";
            setTimeout(hycq_dhk02, 2000);
            msrlswtqp.scrollTop = document.getElementById("bottomdiv").offsetTop - document.documentElement.scrollTop;
        }
        hycq_dhk02 = function () {
            document.getElementById("hycq_dhk02").style.display = "block";
            msrlswtqp.scrollTop = document.getElementById("bottomdiv").offsetTop - document.documentElement.scrollTop;
        }
        swt_center_bswt = function () {
            msrlswtqp.style.display = "block";
            setTimeout(hycq_dhk01, 1000);
        }
        swt_center_nswt = function () {
            msrlswtqp.style.display = "none";
            document.getElementById("hycq_dhk01").style.display = "none";
            document.getElementById("hycq_dhk02").style.display = "none";
            setTimeout(swt_center_bswt, config.relapsetime * 1000)
        }
        setTimeout(swt_center_bswt, config.firsttime * 1000);
        function addEvent(obj, type, fn) {
            if (obj.attachEvent) {
                obj.attachEvent('on' + type, function () {
                    fn.call(obj);
                })
            } else {
                obj.addEventListener(type, fn, false);
            }
        }
        if (_ua_text) {
            var _t = document.getElementById('msrlswtqp').style.top;
            window.onscroll = function () {
                document.getElementById('msrlswtqp').style.top = parseInt(_t) + (getScrollTop() / getClientHeight()) * 100 + '%';
            }
        }

    };
    lib.load(loadFunc);
})('{{lib}}', '{{config}}');